package com.mkyong.common.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import binderon.com.dao.AppUserDao;
import binderon.com.model.AppUser;

public class HelloWorldController extends AbstractController{
	private AppUserDao appUserDao;
	
	/**
	 * @return the appUserDao
	 */
	public AppUserDao getAppUserDao() {
		return appUserDao;
	}

	/**
	 * @param appUserDao the appUserDao to set
	 */
	public void setAppUserDao(AppUserDao appUserDao) {
		this.appUserDao = appUserDao;
	}

	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {
		AppUser appUser = new AppUser("loginId1","p1","fn1","ln1","n@n.n",(byte) 1);
		getAppUserDao().save(appUser);
		
		ModelAndView model = new ModelAndView("HelloWorldPage");
		model.addObject("msg", "hello world");
		
		return model;
	}

}